package com.spatio.serving.basic.service.template.common.util;

import java.io.IOException;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.io.InputStream;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;

/**
 * @Description
 * @Author GuoPengfei
 * @Date 2024/5/23 15:53
 */
public class IoUtils {

    public static void downloadFile(String urlStr, String localFilePath) throws IOException {
        URL url = new URL(urlStr);
        try (InputStream in = url.openStream()) {
            Files.copy(in, Paths.get(localFilePath), StandardCopyOption.REPLACE_EXISTING);
        }
    }
}